#!/usr/bin/env python3
# -*- coding=utf-8 -*-
# 题目：八进制转换为十进制


def f1():
    x = reversed(input("input a number: "))
    r = 0
    for i in range(len(x)):
        r += int(x[i]) * 8**i
    print(r)


f = f1
if __name__ == "__main__":
    f()
